<template>
    <div class="app-container " ref="myPhotoDiv">
        <el-tabs v-model="currentTab" type="card" class="center-tabs tabsLine" @tab-click="tabHandleClick">
            <el-tab-pane label="基本信息" name="baseInfo">
                <span slot="label">
                    基本信息
                    <el-badge v-if="countAngle.visitCount > 0" :value="countAngle.visitCount"
                        class="tab-content-badge"></el-badge>
                </span>

                <el-row class="base-info-box " v-if="baseInfoData.length > 0">
                    <span>姓名:{{ baseInfoData[0].patientName }}</span>
                    <span>性别: <dict-tag :options="dict.type.sys_user_sex" :value="baseInfoData[0].sex"
                            style="display: inline-block;" /></span>
                    <span>出生日期:{{ baseInfoData[0].birthDate }}</span>
                    <span> 身份证:{{ baseInfoData[0].idNum }}</span>
                </el-row>
                <el-collapse v-model="activeName" accordion>
                    <el-collapse-item
                        :title="gethospital(item.hospitalName) + ' — ' + item.deptName + '  ' + '顾客编号：' + item.visitNum + ' 登记日期：' + parseTime(item.createTime) + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                        v-for="(item, index) in baseInfoData" :key="index" :name="index">
                        <template slot="title">
                            <div class="collapse_item_header">
                                {{ gethospital(item.hospitalName) }} — {{ item.deptName }} 顾客编号：{{ item.visitNum }}
                                登记日期：{{
            parseTime(item.createTime) }} 状态： {{ getDiagnosisStatusLabel(item.status) }} 诊断： {{
            item.doctorDiagnosis }}
                            </div>


                        </template>
                        <el-row class="bigFont">
                            <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">顾客编号:<span class="normalFont">{{
            item.visitNum
        }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">顾客ID:<span class="normalFont">{{
            item.patientId }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">手机:<span class="normalFont">{{
            item.patientPhone }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">状态:<span class="normalFont">{{
            matchDict("sys_diagnosis_status", item.status)
        }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">卡号:<span class="normalFont">{{
            item.cardNumber
        }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">顾客分类:<span class="normalFont">{{
            matchDict("sys_patient_sort",
                item.customerSort) }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">皮肤色度:<span class="normalFont">{{
            matchDict("sys_skin_tone", item.tone)
        }}</span></el-col>
                        </el-row>
                        <el-row class="bigFont">
                            <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">患者地址:<span class="normalFont">{{ item.area
                                    }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">详细地址:<span class="normalFont">{{
            item.address
        }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">顾客性质:<span class="normalFont">{{
            matchDict("sys_patient_properties",
                item.properties) }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">职业:<span class="normalFont">
                                    {{ matchDict("sys_career_type", item.job) }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">微信号:<span class="normalFont">{{ item.wxNum
                                    }}</span></el-col>
                            <el-col :xs="24" :sm="12" :md="3" :lg="3" :xl="3">登记人:<span class="normalFont">{{
            item.nickName
        }}</span></el-col>

                        </el-row>
                        <el-row class="bigFont">
                            <el-col :xs="24" :sm="12" :md="4" :lg="4" :xl="4">备注:<span class="normalFont">{{ item.remark
                                    }}</span></el-col>
                        </el-row>

                    </el-collapse-item>
                </el-collapse>
            </el-tab-pane>
            <el-tab-pane label="诊前问卷" name="PrediagnosisQuestionnaire">
                <span slot="label">
                    诊前问卷
                    <el-badge v-if="countAngle.formLogCount > 0" :value="countAngle.formLogCount"
                        class="tab-content-badge"></el-badge>
                </span>
                <el-form :model="questionForm" ref="questionForm" size="small" :inline="true" label-width="78px">
                    <el-form-item label="就诊记录" prop="visitNum" :style="{ width: device == 'mobile' ? '100%' : '790px' }"
                        class="selectForm">
                        <el-select v-model="questionForm.visitNum" placeholder="就诊记录" class="selectRed"
                            style="width:100%" clearable @change="getListCustomerForm()">
                            <el-option v-for="item in baseInfoData" :key="item.visitId"
                                :label="gethospital(item.hospitalName) + ' — ' + item.deptName + ' ' + '顾客编号：' + item.visitNum + ' 登记日期：' + parseTime(item.createTime) + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                                :value="item.visitNum"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item v-if="isUpdate == 1">
                        <el-button size="mini" type="success" @click="addQuestionnaire()"
                            :disabled="formpreviewContList1 == null ? false : true">添加诊前问卷</el-button>

                        <el-button size="mini" type="success" @click="addQuestionnaire2()">添加专病问卷</el-button>
                    </el-form-item>
                </el-form>

                <div style="display: flex;overflow-x: auto;margin-bottom: 20px;">
                    <el-button size="medium" @click="openQuestionnaire(item, index)"
                        v-for="(item, index) in prediagnosisQuestionnaireDataList" :key="index"
                        :class="isActive == index ? 'yesActive' : ''">{{
            item.visitNum + ',' + parseTime(item.writeTime) + ',' + item.formName }}</el-button>
                </div>
                <div>
                    <!-- 诊前问卷 -->
                    <el-dialog :title="questionnaireTitle" :visible.sync="questionnaireDialog" width="90%"
                        append-to-body @close="closeQuestion" :close-on-click-modal="false" v-dialogDrag>
                        <formpreview v-if="formpreviewContList1 != null" :formPreviewList="formpreviewContList1"
                            ref="formPreview" :questionFormInfo="questionFormInfo1" />
                        <div slot="footer" class="dialog-footer">
                            <el-button v-if="dialogNewAddBtnStatus === true" @click="submitAnswer">提 交</el-button>
                            <el-button v-else @click="updateFormAnswer">修 改</el-button>
                            <el-button @click="questionnaireDialog = false">取 消</el-button>
                        </div>
                    </el-dialog>
                    <!-- 专病问卷 -->
                    <el-dialog :title="questionnaireTitle2" :visible.sync="questionnaireDialog2" width="90%"
                        v-dialogDrag @close="closeQuestion" append-to-body :close-on-click-modal="false">
                        <el-row>
                            适用专病：
                            <el-select v-model="selectData.diseaseId" filterable placeholder="专病名称" style="width: 240px"
                                @change="getFormList" :disabled="!dialogNewAddBtnStatus2">
                                <el-option v-for="dict in classifyList" :key="dict.diseaseClassifyId"
                                    :label="dict.diseaseClassifyName" :value="dict.diseaseClassifyId"></el-option>
                            </el-select>
                            专病问卷：<el-select v-model="selectData.formId" filterable placeholder="请选择专病诊前问卷表"
                                style="width: 440px" @change="getFormContByFormId">
                                <el-option v-for="item in formList" :key="item.formId" :label="item.formName"
                                    :value="item.formId"></el-option>
                            </el-select>
                            <el-button v-if="dialogNewAddBtnStatus2 === false" @click="addQuestionForm2" type="primary"
                                style="margin-left:15px">添加新问卷</el-button>
                        </el-row>
                        <el-row class="base-info-box">
                            <span>身份证: {{ formInfo2.idNum }} </span>
                            <span>顾客编号: {{ formInfo2.visitNum }} </span>
                            <span>姓名: {{ formInfo2.patientName }} </span>
                            <span>性别:
                                <dict-tag :options="dict.type.sys_user_sex" :value="formInfo2.sex"
                                    style="display: inline-block" /></span>
                            <span>状态:
                                <dict-tag :options="dict.type.sys_diagnosis_status" :value="formInfo2.status"
                                    style="display: inline-block" />
                            </span>
                        </el-row>
                        <div class="min-height">
                            <formpreview v-if="formpreviewContList2 != null" :formPreviewList="formpreviewContList2"
                                ref="formPreview" :questionFormInfo="questionFormInfo2" />
                        </div>
                        <div slot="footer" class="dialog-footer">
                            <el-button v-if="dialogNewAddBtnStatus2 === true" @click="submitAnswer2" type="primary"
                                :disabled="!selectData.formId">提 交</el-button>
                            <el-button @click="questionnaireDialog2 = false">取 消</el-button>
                        </div>
                    </el-dialog>
                    <formpreview v-if="formpreviewContList != null && formBaseStatus"
                        :formPreviewList="formpreviewContList" :questionFormInfo="questionFormInfo" ref="formPreview" />
                    <div class="dialog-footer" style="margin:0 auto;margin-top:20px;text-align:center;">
                        <el-button v-if="formpreviewContList != null && isUpdate == 1" @click="updateFormAnswer">修
                            改</el-button>
                    </div>

                </div>
                <!-- <el-table :data="prediagnosisQuestionnaireDataList">
                    <el-table-column label="顾客编号" align="center" prop="visitNum" />
                    <el-table-column label="顾客姓名" align="center" prop="patientName" :show-overflow-tooltip="true" />
                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120px">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="问卷名称" align="center" prop="formName" />
                    <el-table-column label="填写设备" align="center" prop="equipment" />
                    <el-table-column label="填写时间" align="center" prop="writeTime">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.writeTime) }}</span>
                        </template></el-table-column>
                    <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width"
                        width="180">
                        <template slot-scope="scope">
                            <el-button size="mini" type="text" icon="el-icon-document"
                                @click="openQuestionnaire(scope.row)">查看</el-button>
                        </template>
                    </el-table-column>
                </el-table> -->
            </el-tab-pane>
            <el-tab-pane label="照片" name="pictures">
                <span slot="label">
                    照片
                    <el-badge v-if="countAngle.photoCount > 0" :value="countAngle.photoCount"
                        class="tab-content-badge"></el-badge>
                </span>
                <el-row>
                    <el-form :model="pictureForm" ref="pictureForm" size="small" :inline="true" label-width="78px">
                        <el-form-item label="就诊记录" prop="visitNum"
                            :style="{ width: device == 'mobile' ? '100%' : '790px' }" class="selectForm">
                            <el-select v-model="pictureForm.visitNum" placeholder="就诊记录" class="selectRed"
                                style="width:100%" clearable @change="getPhotoList">
                                <el-option v-for="item in baseInfoData" :key="item.visitId"
                                    :label="gethospital(item.hospitalName) + ' — ' + item.deptName + '  ' + '顾客编号：' + item.visitNum + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                                    :value="item.visitNum"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="拍照设备" prop="type">
                            <el-select v-model="pictureForm.type" placeholder="拍照设备" style="width: 120px" clearable
                                @change="getPhotoList">
                                <el-option v-for="dict in dict.type.photo_upload_type" :key="dict.value"
                                    :label="dict.label" :value="dict.value"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="采集日期">
                            <el-date-picker v-model="dateRange" style="width: 240px" value-format="yyyy-MM-dd"
                                type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
                                @change="getPhotoList"></el-date-picker>
                        </el-form-item>
                        <el-button type="primary" size="mini" @click="getPhotoList">查询</el-button>
                        <el-button type="primary" size="mini" @click="comparePics">对比显示该顾客照片</el-button>
                        <el-button size="mini" type="success" @click="addphoto" v-if="isUpdate == 1">添加照片</el-button>
                        <el-button type="primary" size="mini" @click="photocompare">前后对比</el-button>

                    </el-form>
                </el-row>
                <!-- 照片上传 -->
                <el-dialog title="照片上传" :visible.sync="pictureDatileopen" :width="device !== 'mobile' ? '85%' : '100%'"
                    append-to-body :close-on-click-modal="false" v-dialogDrag>
                    <photoUpload :isMorePic="false" isPosition="1" :patientItem="patientItem" v-if="pictureDatileopen"
                        @closepictureDatile="refreshList(2)"></photoUpload>
                </el-dialog>
                <el-row v-for="(item, index) in picData" :key="index" style="margin-top:15px;" v-if="picDataStatus">
                    <el-row :gutter="10" style="margin-bottom:10px;">
                        <el-col :xs="24" :sm="24" :md="10" :lg="10" :xl="10" class="group-info">
                            <span> 顾客编号:{{ item.sysPatientPhotos[0].visitNum }}</span>
                            <span> 采集日期:{{ item.sysPatientPhotos[0].createTime }}</span>
                        </el-col>
                        <el-col :xs="24" :sm="16" :md="10" :lg="10" :xl="10" class="group-info">
                            <span class="device">采集时刻:<dict-tag :options="dict.type.sys_diagnosis_status"
                                    :value="item.sysPatientPhotos[0].status" /></span>
                            <span class="device">设备:<dict-tag :options="dict.type.photo_upload_type"
                                    :value="item.sysPatientPhotos[0].type" /></span>
                            <span>上传人:{{ item.sysPatientPhotos[0].nickName }}</span>
                        </el-col>
                        <el-col :xs="24" :sm="8" :md="4" :lg="4" :xl="4" class="group-info"
                            style="justify-content:flex-end">
                            <el-button size="mini" type="primary" v-if="item.photoType == 1" icon="el-icon-s-platform"
                                @click="openPics(item, 0)">AI分析图</el-button>
                            <el-button size="mini" type="success" v-if="item.photoType == 1" icon="el-icon-document"
                                @click="copyAIReport(item, 0)">复制报告链接</el-button>
                            <el-button size="mini" type="primary" v-if="item.photoType == 1" icon="el-icon-document"
                                @click="openAIReport(item, 0)">AI分析报告</el-button>
                            <el-button size="mini" type="primary" icon="el-icon-delete" @click="delPics(item.p_index)"
                                v-show="index === 0 && isUpdate == 1" style="float: right;">删除</el-button>
                            <el-button size="mini" type="primary" @click="startHhbAi(item, index)"
                                style="float: right;">启动黄褐斑Ai</el-button>
                        </el-col>
                        <div style="padding-left:10px;">
                            <span v-if="item.scoreAiAll" style="color: #1890ff">Ai mMASI总分:{{
            (item.scoreAiAll).toFixed(1)
        }}分</span>
                        </div>
                    </el-row>

                    <el-row class="photoImageContent" :gutter="10">

                        <el-col :xs="8" :sm="6" :md="6" :lg="{ span: '4-8' }" :xl="{ span: '4-8' }"
                            v-for="(itemPic, Mindex) in  item.sysPatientPhotos" :key="Mindex">

                            <div class="text-center " v-loading="loadingIndex == item.p_index"
                                element-loading-text="Ai分析中">
                                <div class="user-info-head img-txt" @click="watchBigPic(item, Mindex)">
                                    <lazyImg class="img-style" fit="contain" :src="itemPic.thumbnail">
                                        <!-- 图片加载之前默认在图片元素上方展示的样式--自由发挥 -->
                                        <div class="slotlazyImg-txt">图片加载中...</div>
                                        <template #err>
                                            <!-- 图片加载失败后在上面展示的样式--- 自由发挥 -->
                                            <div class="slotlazyImg-txt">图片加载失败</div>
                                        </template>
                                    </lazyImg>
                                    <!-- <el-image class="img-style" fit="contain" :src="itemPic.thumbnail"
                                        @click="watchBigPic(item, Mindex)" lazy></el-image> -->
                                    <el-button size="mini" type="success" icon="el-icon-download"
                                        @click.stop="downLoadphoto(itemPic.photoAddress, itemPic, item.patientName)"
                                        v-if="isAdmin || isUpdate == 1" class="downBtn">下载原图</el-button>

                                </div>
                                <div class="photoImageContent_formBox_infos">
                                    <dict-tag :options="dict.type.photo_lighting_type" :value="itemPic.faceLight" />
                                    <dict-tag :options="dict.type.sys_face_part" :value="itemPic.facePart" />
                                    <div>{{ (itemPic.fileSize / 1024 / 1024).toFixed(2) }}M(压缩质量:{{
            itemPic.compressionRatio
        }})
                                    </div>
                                    <div v-if="itemPic.scoreAi != null" style="color: #1890ff">Ai mMASI评分:{{
            (itemPic.scoreAi).toFixed(1)
        }}分</div>

                                </div>


                            </div>
                        </el-col>

                    </el-row>

                </el-row>
            </el-tab-pane>
            <el-tab-pane label="知情同意书" name="consent">
                <span slot="label">
                    知情同意书
                    <el-badge v-if="countAngle.nformedConsentCount > 0" :value="countAngle.nformedConsentCount"
                        class="tab-content-badge"></el-badge>
                </span>
                <el-form :model="consentForm" ref="consentForm" size="small" :inline="true" label-width="78px">
                    <el-form-item label="就诊记录" prop="visitNum" :style="{ width: device == 'mobile' ? '100%' : '790px' }"
                        class="selectForm">
                        <el-select v-model="consentForm.visitNum" placeholder="就诊记录" class="selectRed"
                            style="width:100%" clearable @change="getConsentList('1')">
                            <el-option v-for="item in baseInfoData" :key="item.visitId"
                                :label="gethospital(item.hospitalName) + ' — ' + item.deptName + '  ' + '顾客编号：' + item.visitNum + ' 登记日期：' + parseTime(item.createTime) + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                                :value="item.visitNum"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item v-if="isUpdate == 1">

                        <el-button size="mini" type="success" @click="confirmKnow('1')">添加知情同意书</el-button>
                    </el-form-item>
                </el-form>
                <el-dialog title="知情同意书确认" :visible.sync="confirmKnowVisible"
                    :width="device !== 'mobile' ? '670px' : '100%'" append-to-body :close-on-click-modal="false"
                    :before-close="closeConfirmKnow" v-dialogDrag>
                    <div class="uploadBtnBox">
                        <el-button type="primary" plain icon="el-icon-s-custom" size="mini"
                            @click="uploadImage">上传知情同意书</el-button>
                        <el-button class="btn" type="primary" plain icon="el-icon-picture" size="mini"
                            @click="openShooting('1')" v-if="device !== 'mobile'">拍摄知情同意书</el-button>
                    </div>
                    <div class="uploadImageBox" v-loading="loading">
                        <div v-for="(item, index) in imageInfo" :key="index" class="draggable-item">
                            <div class="icon-close" v-if="!item.visitNum" @click="removeImg(item, index)">
                                <i class="el-icon-close" style="background-color: #fff;color:red;font-weight: bold"></i>
                            </div>
                            <el-image style="width: 138px; height: 200px" :src="item.url" fit="contain"
                                :preview-src-list="srcList">
                            </el-image>
                        </div>
                        <!--        <el-image class="img-style" :src="confirmPayUrl" :preview-src-list="srcList"></el-image>-->
                    </div>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="handleCloseConfirmKnow('1')">确认已签署</el-button>
                    </div>

                </el-dialog>
                <!-- 调取摄像头拍摄 -->
                <el-dialog title="拍照" :visible.sync="cameraShootingVisible" v-dialogDrag
                    :width="device !== 'mobile' ? '670px' : '100%'" append-to-body :close-on-click-modal="false">
                    <shooting v-if="cameraShootingVisible" :cameraShootingVisible="cameraShootingVisible"
                        @closeShooting="closeShooting"></shooting>
                </el-dialog>
                <el-row v-for="(item, index) in consentDataList" :key="index" style="margin-top:15px;">
                    <el-col :span="24" class="group-info">
                        <span>顾客编号:{{ item.sysNformedConsents[0].visitNum }}</span>
                    </el-col>
                    <el-col :span="24" class="consentBox">
                        <div v-for="(it, idx) in item.sysNformedConsents" :key="idx" style="margin-top:15px;">
                            <myImg class="consentBoxImage" :src="baseUrl + it.url" :preview-src-list="consentSrcList"
                                :myImgIndex="idx" fit="contain" @click="getConsentPreviewList(item)">
                            </myImg>
                            <div class="consentBoxtext">上传人:{{ it.nickName }}</div>
                            <div class="consentBoxtext">上传日期:{{ it.createTime }}</div>
                        </div>
                    </el-col>
                </el-row>


            </el-tab-pane>
            <el-tab-pane label="治疗照片" name="treatmentPhoto">
                <span slot="label">
                    治疗照片
                    <el-badge v-if="countAngle.treatmentPhotosCount > 0" :value="countAngle.treatmentPhotosCount"
                        class="tab-content-badge"></el-badge>
                </span>
                <el-form :model="consentForm" ref="consentForm" size="small" :inline="true" label-width="78px">
                    <el-form-item label="就诊记录" prop="visitNum" :style="{ width: device == 'mobile' ? '100%' : '790px' }"
                        class="selectForm">
                        <el-select v-model="consentForm.visitNum" placeholder="就诊记录" class="selectRed"
                            style="width:100%" clearable @change="getConsentList('3')">
                            <el-option v-for="item in baseInfoData" :key="item.visitId"
                                :label="gethospital(item.hospitalName) + ' — ' + item.deptName + '  ' + '顾客编号：' + item.visitNum + ' 登记日期：' + parseTime(item.createTime) + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                                :value="item.visitNum"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item v-if="isUpdate == 1">

                        <el-button size="mini" type="success" @click="confirmKnow('3')">添加治疗照片</el-button>
                    </el-form-item>
                </el-form>
                <el-dialog title="上传治疗照片" :visible.sync="uploadPhotosVisible"
                    :width="device !== 'mobile' ? '670px' : '100%'" append-to-body :close-on-click-modal="false"
                    :before-close="closeConfirmKnow" v-dialogDrag>
                    <div class="uploadBtnBox">
                        <el-button type="primary" plain icon="el-icon-s-custom" size="mini"
                            @click="uploadImage">上传治疗照片</el-button>
                        <el-button class="btn" type="primary" plain icon="el-icon-picture" size="mini"
                            @click="openShooting('3')" v-if="device !== 'mobile'">拍摄治疗照片</el-button>
                    </div>
                    <div class="uploadImageBox" v-loading="loading">
                        <div v-for="(item, index) in imageInfo" :key="index" class="draggable-item">
                            <div class="icon-close" v-if="!item.visitNum" @click="removeImg(item, index)">
                                <i class="el-icon-close" style="background-color: #fff;color:red;font-weight: bold"></i>
                            </div>
                            <el-image style="width: 138px; height: 200px" :src="item.url" fit="contain"
                                :preview-src-list="srcList">
                            </el-image>
                        </div>
                    </div>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="handleCloseConfirmKnow('3')">确认上传</el-button>
                    </div>

                </el-dialog>
                <el-row v-for="(item, index) in consentDataList" :key="index" style="margin-top:15px;">
                    <el-col :span="24" class="group-info">
                        <span>顾客编号:{{ item.sysNformedConsents[0].visitNum }}</span>
                    </el-col>
                    <el-col :span="24" class="consentBox">
                        <div v-for="(it, idx) in item.sysNformedConsents" :key="idx" style="margin-top:15px;">
                            <myImg class="consentBoxImage" :src="baseUrl + it.url" :preview-src-list="consentSrcList"
                                :myImgIndex="idx" fit="contain" @click="getConsentPreviewList(item)">
                            </myImg>
                            <div class="consentBoxtext">上传人:{{ it.nickName }}</div>
                            <div class="consentBoxtext">上传日期:{{ it.createTime }}</div>
                        </div>
                    </el-col>
                </el-row>


            </el-tab-pane>
            <el-tab-pane label="温馨提示" name="warmReminder">
                <span slot="label">
                    温馨提示
                    <el-badge v-if="countAngle.tipsCount > 0" :value="countAngle.tipsCount"
                        class="tab-content-badge"></el-badge>
                </span>
                <el-form :model="warmReminderRecordParams" ref="warmReminderRecordParams" size="small" :inline="true"
                    label-width="78px">
                    <el-form-item label="就诊记录" prop="visitNum" :style="{ width: device == 'mobile' ? '100%' : '790px' }"
                        class="selectForm">
                        <el-select v-model="warmReminderRecordParams.visitNum" placeholder="就诊记录" class="selectRed"
                            style="width:100%" clearable @change="getWarmReminderRecord()">
                            <el-option v-for="item in baseInfoData" :key="item.visitId"
                                :label="gethospital(item.hospitalName) + ' — ' + item.deptName + '  ' + '顾客编号：' + item.visitNum + ' 登记日期：' + parseTime(item.createTime) + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                                :value="item.visitNum"></el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <el-table border :data="warmReminderRecordData">
                    <el-table-column label="序号" align="center" type="index" width="50">
                        <template slot-scope="scope">
                            <span>{{ getWarmReminderRecordIndex(scope.$index) }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column sortable align="center" prop="visitNum" label="顾客编号" width="160"></el-table-column>
                    <el-table-column sortable align="center" prop="title" label="文本标题"
                        :show-overflow-tooltip="true"></el-table-column>
                    <el-table-column sortable align="center" prop="selfTips" label="个性提示"
                        :show-overflow-tooltip="true"></el-table-column>
                    <el-table-column sortable align="center" prop="nickName" label="创建医生" width="180"></el-table-column>
                    <el-table-column sortable align="center" prop="createTime" label="创建日期"
                        width="180"></el-table-column>
                    <el-table-column align="center" fixed="right" label="操作" class-name="small-padding fixed-width"
                        width="100">
                        <template slot-scope="scope">
                            <el-button size="mini" type="text" icon="el-icon-document"
                                @click="lookRecordItem(scope.row)">查看</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-dialog title="温馨提示" :visible.sync="warmReminderDialogVisible" width="85%" center
                    :close-on-click-modal="false" :append-to-body="true" v-dialogDrag>
                    <div v-html="warmReminderContent.content">
                    </div>
                </el-dialog>



            </el-tab-pane>
            <el-tab-pane label="随访记录" name="followupVisitDataList">
                暂无数据
                <!-- <div style="display: flex;overflow-x: auto;">
                    <el-button size="mini" type="primary" @click="openFollowupVisit(item)"
                        v-for="item in followupVisitDataList" :key="item.id">{{
                            parseTime(item.followupTime) + item.name }}</el-button>
                </div>
                <div>
                    <formpreview v-if="formpreviewContList != null" :formPreviewList="formpreviewContList"
                        :questionFormInfo="questionFormInfo" />
                </div> -->
                <!-- <el-table :data="followupVisitDataList">
                    <el-table-column label="序号" align="center" type="index" width="50">
              <template slot-scope="scope">
                <span>{{ getIndex(scope.$index) }}</span>
              </template>
            </el-table-column>
                    <el-table-column label="顾客编号" align="center" prop="id" />
                    <el-table-column label="顾客姓名" align="center" prop="name" :show-overflow-tooltip="true" />
                    <el-table-column label="登记日期" align="center" prop="registrationDate" width="180"></el-table-column>
                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120px">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="诊断" align="center" prop="diagnosis" />
                    <el-table-column label="咨询医生" align="center" prop="consultants" />
                    <el-table-column label="开单医生" align="center" prop="doctorName" />
                    <el-table-column label="随访时间" align="center" prop="followupTime" />
                    <el-table-column label="形式" align="center" prop="followupForm" />
                    <el-table-column label="随访时刻" align="center" prop="followupMoment" />
                    <el-table-column label="随访人" align="center" prop="followupPeople" />
                    <el-table-column label="随访记录" align="center" prop="followupRecords" />
                </el-table> -->
            </el-tab-pane>
            <el-tab-pane label="诊断和方案" name="diagnosisAndProject">
                <span slot="label">
                    诊断和方案
                    <el-badge v-if="countAngle.doctorCount > 0" :value="countAngle.doctorCount"
                        class="tab-content-badge"></el-badge>
                </span>
                <el-form :model="diagnosisQueryParams" ref="diagnosisQueryParams" size="small" :inline="true"
                    label-width="78px">
                    <el-form-item label="就诊记录" prop="visitNum" :style="{ width: device == 'mobile' ? '100%' : '790px' }"
                        class="selectForm">
                        <el-select v-model="diagnosisQueryParams.visitNum" placeholder="就诊记录" class="selectRed"
                            style="width:100%" clearable @change="getDiagnosisAndProject()">
                            <el-option v-for="item in baseInfoData" :key="item.visitId"
                                :label="gethospital(item.hospitalName) + ' — ' + item.deptName + '  ' + '顾客编号：' + item.visitNum + ' 登记日期：' + parseTime(item.createTime) + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                                :value="item.visitNum"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item v-if="isUpdate == 1">
                        <el-button size="mini" type="success" @click="newAdddiagnosis()"
                            v-if="isdiagnosisAdd == 1">添加方案</el-button>
                        <el-button size="mini" type="success" @click="updatePlandiagnosis()"
                            v-if="isdiagnosisAdd == 2">修改方案</el-button>
                        <el-button size="mini" type="success" @click="catePlandiagnosis()"
                            v-if="isdiagnosisAdd == 1">历史诊断方案({{
            CountPatient.length - 1 }})</el-button>
                        <el-button type="success" size="mini" @click="addNext">下次预约</el-button>
                        <span v-if="latestAppointmentItem && latestAppointmentItem.appointmentDate"
                            style="margin-left: 20px;margin-right: 20px;font-weight: bold;color:red">下次预约日期:{{
            latestAppointmentItem.appointmentDate }} {{ latestAppointmentItem.week }}
                            {{ latestAppointmentItem.timeSlot == 0 ? '上午' : '下午' }}</span>


                    </el-form-item>
                </el-form>
                <!-- 新增或者修改方案 -->
                <el-dialog :title="diagnosisTitle" :visible.sync="diagnosisDialogVisible" width="100%" center
                    append-to-body @close="closefullScreen" :before-close="closediagnosisDialogVisible" v-dialogDrag>
                    <diagnosisListDetail v-if="diagnosisDialogVisible" :baseInfo="baseInfo" :catePlanObj="catePlanObj"
                        @closeCenterDialogVisible="closediagnosisDialogVisible">
                    </diagnosisListDetail>
                </el-dialog>
                <el-table :data="diagnosisAndProjectDataList" border>
                    <el-table-column label="序号" align="center" type="index" width="50" sortable>
                        <template slot-scope="scope">
                            <span>{{ getIndex(scope.$index) }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="顾客编号" align="center" prop="visitNum" sortable width="160" />
                    <el-table-column label="顾客姓名" align="center" prop="patientName" width="100"
                        :show-overflow-tooltip="true" sortable />
                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120"
                        sortable>
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="诊断方案日期" align="center" prop="doctorTime" width="180"
                        sortable></el-table-column>
                    <el-table-column label="诊断医生" align="center" prop="doctor" sortable width="100" />
                    <el-table-column sortable label="医生诊断" align="left" prop="doctorDiagnosis" width="220">
                        <template slot-scope="scope">
                            <span v-html="scope.row.doctorDiagnosis"></span>
                        </template>
                    </el-table-column>
                    <el-table-column sortable label="医生方案" align="center" prop="doctorPlan" width="220">
                        <template slot-scope="scope">
                            <el-tooltip placement="top" effect="light">
                                <div slot="content"
                                    style="max-width: 500px;line-height:25px;font-size:16px;background:#fff;padding:15px;border:1px solid #eee;">
                                    {{ scope.row.doctorPlan }}
                                </div>
                                <div style="color: #10a1df;overflow: hidden;
                                    white-space: nowrap;
                                    text-overflow: ellipsis;">
                                    {{ scope.row.doctorPlan }}
                                </div>
                            </el-tooltip>
                        </template>
                    </el-table-column>
                    <el-table-column label="咨询方案日期" align="center" prop="consultationTime" width="180"
                        sortable></el-table-column>
                    <el-table-column label="咨询医生" align="center" prop="consultationer" sortable width="100" />
                    <el-table-column sortable label="咨询诊断" align="left" prop="consultationDiagnosis" width="220">
                        <template slot-scope="scope">
                            <span v-html="scope.row.consultationDiagnosis"></span>
                        </template>
                    </el-table-column>
                    <el-table-column sortable label="咨询方案" align="center" prop="consultationPlan" width="220">
                        <template slot-scope="scope">
                            <el-tooltip placement="top" effect="light">
                                <div slot="content"
                                    style="max-width: 500px;line-height:25px;font-size:16px;background:#fff;padding:15px;border:1px solid #eee;">
                                    {{ scope.row.consultationPlan }}
                                </div>
                                <div style="color: #10a1df;overflow: hidden;
                                    white-space: nowrap;
                                    text-overflow: ellipsis;">
                                    {{ scope.row.consultationPlan }}
                                </div>
                            </el-tooltip>
                        </template>
                    </el-table-column>
                    <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width"
                        width="150">
                        <template slot-scope="scope">

                            <el-button size="mini" type="text" icon="el-icon-document"
                                @click="goHistoryDiagnosis(scope.row)">诊断医生历史记录</el-button>
                        </template>
                    </el-table-column>


                </el-table>
            </el-tab-pane>
            <el-tab-pane label="治疗记录" name="treatmentRecord">
                <span slot="label">
                    治疗记录
                    <el-badge v-if="countAngle.treatmentCount > 0" :value="countAngle.treatmentCount"
                        class="tab-content-badge"></el-badge>
                </span>
                <!--                <el-row class="treatment-tips">-->
                <!--                     <span>激光10次余3次</span> <span>皮秒10次余1次</span> -->
                <!--                </el-row>-->
                <el-form :model="treatmentRecordQueryParams" ref="treatmentRecordQueryParams" size="small"
                    :inline="true" label-width="78px">
                    <el-form-item label="就诊记录" prop="visitNum" :style="{ width: device == 'mobile' ? '100%' : '790px' }"
                        class="selectForm">
                        <el-select v-model="treatmentRecordQueryParams.visitNum" placeholder="就诊记录" class="selectRed"
                            style="width:100%" clearable @change="getTreatmentList()">
                            <el-option v-for="item in baseInfoData" :key="item.visitId"
                                :label="gethospital(item.hospitalName) + ' — ' + item.deptName + '  ' + '顾客编号：' + item.visitNum + ' 登记日期：' + parseTime(item.createTime) + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                                :value="item.visitNum"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item v-if="isUpdate == 1">
                        <el-button size="mini" type="success" @click="newAddtreat()"
                            v-if="istreatAdd == 1">添加治疗方案</el-button>

                        <el-button size="mini" type="success" @click="newUptreat()" :disabled="single"
                            v-if="istreatAdd == 2 || treatmentRecordTotal > 0">修改治疗方案</el-button>
                    </el-form-item>
                </el-form>
                <el-dialog :title="recordTitle" :visible.sync="recordVisible" width="85%" append-to-body
                    :close-on-click-modal="false" :before-close="closerecordDialogVisible" v-dialogDrag>
                    <treatmentDetail v-if="recordVisible" :recordbaseInfo="recordbaseInfo" :submitStatus="submitStatus"
                        @closerecordDialogVisible="closerecordDialogVisible"></treatmentDetail>
                </el-dialog>
                <el-table :data="treatmentRecordDataList" show-summary :summary-method="getSummaries" border
                    @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55" align="center" />
                    <el-table-column label="序号" align="center" type="index" width="50" sortable>
                        <template slot-scope="scope">
                            <span>{{ getTreatmentRecordIndex(scope.$index) }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="顾客编号" align="center" prop="visitNum" sortable width="160" />
                    <el-table-column label="顾客姓名" align="center" prop="patientName" :show-overflow-tooltip="true"
                        width="100" sortable />
                    <el-table-column label="登记日期" align="center" prop="createTime" width="180" sortable>
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.createTime) }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="医生诊断" align="center" prop="doctorDiagnosis" sortable width="220" />
                    <el-table-column label="治疗医生" align="center" prop="treatmentDoctorName" sortable width="100">
                        <template slot-scope="scope">
                            <span>{{ scope.row.treatmentDoctorName ? scope.row.treatmentDoctorName :
            scope.row.treatmentDoctor
                                }}</span>
                        </template>
                    </el-table-column>

                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120px"
                        sortable>
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="治疗项目" align="center" prop="packageContent" sortable width="100" />
                    <el-table-column sortable label="治疗部位" align="center" prop="treatmentPlace" width="100">
                    </el-table-column>
                    <el-table-column label="治疗次数" align="center" prop="treatmentTimes" sortable width="100">
                        <template slot-scope="scope">
                            <span>1</span>
                        </template>
                    </el-table-column>
                    <el-table-column sortable label="治疗年龄" align="center" prop="treatmentAge"
                        :show-overflow-tooltip="true" width="100" />
                    <el-table-column sortable label="治疗反应" align="center" prop="treatmentReaction" width="100">
                        <template slot-scope="scope">
                            <span>{{ getTreatmentReactionText(scope.row.treatmentReaction) }}</span>
                            <!-- <dict-tag :options="dict.type.sys_treatment_reaction" :value="scope.row.treatmentReaction" /> -->
                        </template>
                    </el-table-column>
                    <el-table-column sortable label="治疗效果" align="center" prop="treatmentEffect" width="100">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_treatment_effect" :value="scope.row.treatmentEffect" />
                        </template>
                    </el-table-column>
                    <el-table-column sortable label="治疗日期" align="center" prop="consultationDate" width="155">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.treatmentTime) }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column sortable label="治疗价格" align="center" prop="treatmentPrice" width="100" />
                    <el-table-column label="治疗参数" align="center" prop="remark" sortable width="220" />
                </el-table>
                <pagination v-show="treatmentRecordTotal > 0" :total="treatmentRecordTotal"
                    :page.sync="treatmentRecordQueryParams.pageNum" :limit.sync="treatmentRecordQueryParams.pageSize"
                    @pagination="getTreatmentList" />
            </el-tab-pane>
            <el-tab-pane label="皮肤CT" name="skinct">
                皮肤CT
            </el-tab-pane>
            <el-tab-pane label="检测指标" name="detectionIndex">
                <span slot="label">
                    检测指标
                    <el-badge v-if="countAngle.visitDetectionCount > 0" :value="countAngle.visitDetectionCount"
                        class="tab-content-badge"></el-badge>
                </span>
                <el-form :model="detectionIndexForm" ref="detectionIndexForm" size="small" :inline="true"
                    label-width="78px">
                    <el-form-item label="就诊记录" prop="visitNum" :style="{ width: device == 'mobile' ? '100%' : '790px' }"
                        class="selectForm">
                        <el-select v-model="detectionIndexForm.visitNum" placeholder="就诊记录" class="selectRed"
                            style="width:100%" clearable @change="getlistDetectionVisit()">
                            <el-option v-for="item in baseInfoData" :key="item.visitId"
                                :label="gethospital(item.hospitalName) + ' — ' + item.deptName + '  ' + '顾客编号：' + item.visitNum + ' 登记日期：' + parseTime(item.createTime) + ' 状态：' + getDiagnosisStatusLabel(item.status) + ' 诊断：' + item.doctorDiagnosis"
                                :value="item.visitNum"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item v-if="isUpdate == 1">
                        <el-button size="mini" type="success" @click="handleAdd">添加检测指标</el-button>
                    </el-form-item>
                </el-form>
                <!-- 新增检测指标 -->
                <el-dialog :title="planTitle" :visible.sync="centerDialogVisible" v-dialogDrag width="90%"
                    append-to-body :close-on-click-modal="false">
                    <detectionAdd v-if="centerDialogVisible" :baseAdd="baseAdd"
                        @closeCenterDialogVisible="closeCenterDialogVisible" @refresh="closeCenterDialogVisible">
                    </detectionAdd>
                </el-dialog>
                <div>
                    <el-table border v-loading="loading" style="width: 100%" :data="listDetectionVisit">
                        <el-table-column label="序号" align="center" type="index" width="50">
                            <template slot-scope="scope">
                                <span>{{ getDetectionIndexFormIndex(scope.$index) }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="顾客编号" align="center" prop="visitNum" width="160">
                        </el-table-column>
                        <el-table-column label="顾客姓名" align="center" prop="patientName" :show-overflow-tooltip="true"
                            width="100" />
                        <el-table-column label="检测指标" align="center" prop="visitDetectionName">
                        </el-table-column>
                        <el-table-column label="检测值" align="center" prop="detectionValue" :show-overflow-tooltip="true"
                            width="160" />
                        <el-table-column label="异常标志" align="center" prop="defaultValue" :show-overflow-tooltip="true"
                            width="120">
                            <template slot-scope="scope">
                                <span :style="{ color: getLabel(scope.row) == '异常' ? 'red' : 'green' }">{{
            getLabel(scope.row) }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column label="正常值" align="center" prop="defaultValue" :show-overflow-tooltip="true"
                            width="120">
                            <template slot-scope="scope">
                                <span v-if="scope.row.hightValue != '' && scope.row.hightValue != null">{{
            scope.row.limitValue }} ~
                                    {{ scope.row.hightValue }}</span>
                                <span
                                    v-else-if="(scope.row.hightValue == '' || scope.row.hightValue == null) && scope.row.defaultValue != '' && scope.row.defaultValue != null">{{
            scope.row.defaultValue }}</span>
                                <span v-else>-</span>
                            </template>
                        </el-table-column>

                        <el-table-column label="检测医生" align="center" width="100">
                            <template slot-scope="scope">
                                <span>{{ scope.row.nickName ? scope.row.nickName : scope.row.createBy }}</span>
                            </template>
                        </el-table-column>
                        <el-table-column sortable label="检测日期" align="center" prop="createTime">
                            <template slot-scope="scope">
                                <span>{{ parseTime(scope.row.createTime) }}</span>
                            </template>
                        </el-table-column>
                    </el-table>
                    <pagination v-show="Listtotal > 0" :total="Listtotal" :page.sync="detectionIndexForm.pageNum"
                        :limit.sync="detectionIndexForm.pageSize" @pagination="getlistDetectionVisit" />
                </div>

            </el-tab-pane>
        </el-tabs>
        <el-dialog title="照片比对" :visible.sync="comparePicsDialogVisible" width="85%" center
            :close-on-click-modal="false" :append-to-body="true" v-dialogDrag>
            <comparePics :patientId="basicInfo.patientId" v-if="comparePicsDialogVisible"></comparePics>
             
            

        </el-dialog>
        <el-dialog title="照片标注" :visible.sync="picMarkDialogVisible" width="100%" center :close-on-click-modal="false"
            class="nopaddingBody fullDialog" :append-to-body="true">
            <PhotoMark :currentUrl="currentUrl" :imgList="imgList" :myImgIndex="myImgIndex" v-if="picMarkDialogVisible"
                @closedEvent="picMarkDialogVisible = false">
            </PhotoMark>
        </el-dialog>
        <el-dialog title="AI分析图" :visible.sync="analysisPicsVisiable" width="100%" center :close-on-click-modal="false"
            class="nopaddingBody fullDialog" :append-to-body="true">
            <analysisPics :currentUrl="currentUrl" :pIndex="analysisPicspIndex" :imgArray="imgList"
                :myImgIndex="myImgIndex" v-if="analysisPicsVisiable" @closedEvent="analysisPicsVisiable = false">
            </analysisPics>
        </el-dialog>
        <el-dialog title="历史诊断" :visible.sync="historyDiagnosisDialogVisible" width="85%" center
            :close-on-click-modal="false" :append-to-body="true" v-dialogDrag>
            <el-table :data="historyDiagnosisSignalList" border>

                <el-table-column label="顾客编号" align="center" prop="visitNum" sortable width="160" />
                <el-table-column label="顾客姓名" align="center" prop="patientName" width="100"
                    :show-overflow-tooltip="true" sortable />
                <el-table-column label="诊断方案日期" align="center" prop="updateTime" width="180" sortable></el-table-column>
                <el-table-column sortable label="初复诊" align="center" prop="returnStatus" width="220">
                    <template slot-scope="scope">
                        <span>{{ scope.row.returnStatus == '0' ? '初诊' : '复诊' }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="诊断医生" align="center" prop="nick_name" sortable width="100">
                    <template slot-scope="scope">
                        <span v-if="scope.row.nickName">{{ scope.row.nickName }}</span>
                        <span v-else>{{ scope.row.nick_name }}</span>
                    </template>
                </el-table-column>
                <el-table-column sortable label="医生诊断" align="left" prop="diagnosis" width="220">
                    <template slot-scope="scope">
                        <span v-html="scope.row.diagnosis"></span>
                    </template>
                </el-table-column>
                <el-table-column sortable label="医生方案" align="center" prop="diagnosisPlan">
                    <template slot-scope="scope">
                        <el-tooltip placement="top" effect="light">
                            <div slot="content"
                                style="max-width: 500px;line-height:25px;font-size:16px;background:#fff;padding:15px;border:1px solid #eee;">
                                {{ scope.row.diagnosisPlan }}
                            </div>
                            <div style="color: #10a1df;overflow: hidden;
                                    white-space: nowrap;
                                    text-overflow: ellipsis;">
                                {{ scope.row.diagnosisPlan }}
                            </div>
                        </el-tooltip>
                    </template>
                </el-table-column>

            </el-table>


        </el-dialog>
        <!-- 历史记录 -->
        <el-dialog title="历史诊断记录" :visible.sync="historyVisible" v-dialogDrag
            :width="device !== 'mobile' ? '1000px' : '100%'" append-to-body :close-on-click-modal="false">
            <diagnosisCitate v-if="historyVisible" :basicInfo="baseInfo" @comfirmCitate="addPlanCitate" :type="1">
            </diagnosisCitate>
        </el-dialog>
        <!-- 下次预约 -->
        <el-dialog title="预约" :visible.sync="appointReservaDialogVisible" v-dialogDrag width="80%" append-to-body
            :close-on-click-modal="false" @close="closeAppointReserva">
            <appointReservate v-if="appointReservaDialogVisible" :basicInfo="baseInfo">
            </appointReservate>
        </el-dialog>
        <!-- 报告预览 start -->
        <el-dialog title="报告预览" :visible.sync="reportVisiable" :modal="true" :append-to-body="true" :width="device !== 'mobile' ? '1060px' : '100%'">
            <div style="height:76vh">
                <iframe :src="reportURL" style="width:100%;min-height: 100%;"></iframe>
            </div>

        </el-dialog>
        <!-- 前后对比 -->
        <el-dialog title="照片标注" :visible.sync="photoCompareMathDialogVisible" width="100%" center :close-on-click-modal="false"
        :append-to-body="true"  class="nopaddingBody fullDialog" >
         <photoCompareMath></photoCompareMath>
        </el-dialog>
        <Screenfull v-show="false" ref="Screenfull"></Screenfull>
        <input ref="copyInput" style="position: absolute; left: -9999px; top: 0; opacity: 0;" v-model="copyValue" />
    </div>
</template>

<script>
import { mapGetters } from "vuex";
import { getVisit, listVisitTip, getAngleCount, getQuestionnaireCommon } from "@/api/patientRegistration/registrationList"
import { getTreatmentList, consentList, consentListAll, consentUploads } from "@/api/treatmentWorkstation/treatmentManagement";
import { addressJson, listPhoto } from "@/api/patients/personal";
import { listPhotos } from "@/api/patients/patient";
import Formpreview from "@/views/system/form/Formpreview";
import myImg from "@/views/components/myImg/myMainImg"
import comparePics from "@/views/photoWorkstation/photoList/comparePics";
import photoCompareMath from "@/views/components/photoMark/photoCompareMath";

import {
    listFormCont,
    listCustomerForm,
    addFormAnswer,
    updateAnswer,
    currencyFormId,
    listForm,
    detailFormAndAnswer,
    listFormDept
} from "@/api/system/form";
import PhotoMark from "@/views/components/photoMark/photoMark.vue";
import { listDetectionVisit } from "@/api/photoWorkstation/detection";
import { delPhotoByGroup, startAi } from "@/api/photoWorkstation/photoList";
import { myHistoryDiagnosis, getList } from "@/api/doctorWorkstation/diagnosisList";
import photoUpload from "@/views/components/uploadImage/photoUpload.vue";
import shooting from "@/views/components/camera/shooting";
import detectionAdd from "@/views/components/detection/add";
import analysisPics from "@/views/components/analysisPics/index";//analysisPics  AI分析图
import diagnosisListDetail from "@/views/components/customerDetail/diagnosisListDetail1";
import treatmentDetail from "@/views/components/customerDetail/treatmentDetail";
import Screenfull from "@/components/Screenfull";
import diagnosisCitate from "@/views/components/customerDetail/diagnosisCitate";
import { listClassify } from "@/api/system/classify";
import { latestAppointment } from "@/api/appointManage/appointReserve";
import appointReservate from "@/views/components/customerDetail/appointReservate";
import {
    fileOpen,
    directoryOpen,
    fileSave,
    supported,
} from 'browser-fs-access';
import { getTipsList } from "@/api/warmReminder/warmReminder";
import { listText } from "@/api/system/text";
export default {
    name: "customerDetails",
    components: {
        Formpreview,
        comparePics,
        photoCompareMath,
        myImg,
        photoUpload,
        PhotoMark,
        shooting,
        detectionAdd,
        diagnosisListDetail,
        treatmentDetail,
        Screenfull,
        diagnosisCitate,
        appointReservate,
        analysisPics
    },
    dicts: ['sys_diagnosis_status', 'sys_career_type', 'sys_user_sex', "photo_upload_type", "photo_lighting_type", "sys_face_part", "sys_patient_properties", "sys_skin_tone", "sys_patient_sort", 'sys_treatment_reaction', 'sys_treatment_effect'],
    props: ['basicInfo'],

    data() {
        return {
            photoCompareMathDialogVisible:false,
            copyValue: '',
            reportVisiable: false,
            reportURL: '',
            picDataStatus: false,
            // 非单个禁用
            single: true,
            imageInfo: [],//上传的本地知情同意书照片信息
            // 遮罩层
            confirmKnowVisible: false,
            uploadPhotosVisible: false,
            pictureDatileopen: false,
            patientItem: {},
            loading: true,
            loadingIndex: '',
            cycleTimer: null,
            baseUrl: process.env.VUE_APP_BASE_API,
            currentTab: 'baseInfo',
            isActive: 0,
            // 省市区
            areaList: [],

            baseInfoForm: {
                id: 1,
                name: '王晓',
                sex: 0,
                age: 23,
                phoneNumber: '',
                IDnumber: '111001199010123210',
                wechat: '',
                wechatName: '',
                patientAddress: '',
                detailedAddress: '',
                visitDepartment: '皮肤科',
                status: 0,
                cardNumber: '121001',
                xingZhi: '临床',
                customerClassification: 'vip',
                diagnosis: '诊断内容',
                PrediagnosisQuestionnaire: '未填写',
                pictures: 0,
                registerPerson: '登记护士',
                registrationDate: '2022-09-05 10:29:39',
                consultants: '咨询护士',
                consultationDate: '2022-09-05 11:39:19',
                doctorName: '诊断医生',
                firstVisitDate: '2022-09-05 15:36:49',
                consent: '是否接受咨询',
                treatmentPrograms: '别熬夜',
                numberOfTreatments: '3/10',
                remark: '备注内容',
                date: '',
            },
            queryParams: { pageNum: 1, pageSize: 10 },
            diagnosisQueryParams: {
                pageNum: 1,
                pageSize: 9999,
                visitNum: '',
                patientId: '',
            },
            treatmentRecordQueryParams: {
                pageNum: 1,
                pageSize: 10,
                visitNum: '',
                patientId: '',
            },
            treatmentRecordTotal: 0,
            baseInfoData: [],
            // 拍摄照片表单
            pictureForm: {
                photoLightingType: '',
                type: '',
                visitNum: '',
                patientId: ''
            },
            //诊前问卷表单
            questionForm: { visitNum: '', },
            prediagnosisQuestionnaireDataList: [],
            consentDataList: [
                // {
                //     index: 1,
                //     id: 1,
                //     name: '王晓',
                //     registrationDate: '2022-09-05 10:29:39',
                //     status: 0,
                //     diagnosis: '诊断内容',
                //     consentName: '知情同意书名称',
                //     signStatus: '已签署',
                //     signTime: '2022-09-05 10:29:39',
                // }
            ],
            followupVisitDataList: [
                // {
                //     index: 1,
                //     id: 1,
                //     name: '王晓',
                //     registrationDate: '2022-09-05 10:29:39',
                //     status: 0,
                //     diagnosis: '诊断内容',
                //     consultants: '咨询护士',
                //     doctorName: '开单医生',
                //     followupTime: '2022-09-05 10:29:39',
                //     followupForm: '电话',
                //     followupMoment: '咨询前',
                //     followupPeople: '随访人',
                //     followupRecords: '随访记录',
                // }
            ],
            diagnosisAndProjectDataList: [],
            treatmentRecordDataList: [],
            // 诊前问卷弹出层标题
            questionnaireTitle: "",
            // 知情同意书弹出层是否显示
            consentDialog: false,
            // 诊前问卷表单控件列表
            formpreviewContList: null,
            formBaseStatus: true,
            formpreviewContList1: null,
            formInfo: {},
            questionFormInfo: {
                name: '',
                remark: '',
            },
            questionFormInfo1: {
                name: '',
                remark: '',
            },
            questionFormInfo2: {
                name: '',
                remark: '',
            },
            picData: [],
            srcList: [],
            fileSizeListData: [],
            // 日期范围
            //专病问卷
            formInfo2: {},
            classifyList: [],
            formpreviewContList2: null,
            selectData: { formId: null, diseaseId: null }, //选中的表单
            questionnaireTitle2: "", // 诊前问卷弹出层标题
            questionnaireDialog2: false, // 诊前问卷弹出层是否显示
            dialogNewAddBtnStatus2: false, //诊前问卷弹窗新增或者修改状态
            formList: [], //表单列表
            //专病问卷
            dateRange: [],
            myAnswer: null,//存放表单答案
            myAnswer1: null,//存放表单答案 弹窗
            myAnswer2: null,//存放表单答案 弹窗
            activeName: 0,
            zqtysImg: require("@/assets/images/zqtys.jpg"),
            comparePicsDialogVisible: false,

            picMarkDialogVisible: false,
            analysisPicsVisiable: false,
            currentUrl: '',
            imgList: [],
            myImgIndex: '',

            listDetectionVisit: [],
            detectionIndexForm: {
                pageNum: 1,
                pageSize: 10,
                visitNum: '',
                patientId: ''
            },
            Listtotal: 0,
            consentForm: {
                type: '',
                visitNum: '',
                patientId: ''
            },
            //温馨提示
            warmReminderRecordParams: {
                pageNum: 1,
                pageSize: 9999,
                visitNum: '',
                patientId: ''
            },
            warmReminderRecordData: [],
            // 专病表格数据
            warmReminderClassifyList: [],
            warmReminderContent: {},
            warmReminderDialogVisible: false,

            consentSrcList: [],
            countAngle: {
                formLogCount: 0,
                nformedConsentCount: 0,
                photoCount: 0,
                treatmentCount: 0,
                visitCount: 0,
                doctorCount: 0,
                tipsCount: 0,
                treatmentPhotosCount: 0,
            },
            historyDiagnosisDialogVisible: false,
            historyDiagnosisList: [],
            historyDiagnosisSignalList: [],
            //问卷弹窗
            dialogNewAddBtnStatus: true,
            questionnaireDialog: false,
            cameraShootingVisible: false,
            cameraShootingType: '',
            blobs: [],//获取的知情同意书照片信息
            centerDialogVisible: false,
            baseAdd: { isDetail: false, isShow: 1 },
            planTitle: "",
            diagnosisDialogVisible: false,
            diagnosisTitle: '',
            baseInfo: { updateStatus: false, isDetail: 1 },
            isdiagnosisAdd: 3,//1 新增  2 修改 3不显示
            istreatAdd: 0,//0 不显示  1 添加  2 修改
            recordTitle: '治疗方案',
            recordVisible: false,
            recordbaseInfo: { updateStatus: true },
            submitStatus: true,
            // 选中数组
            ids: [],
            CountPatient: [],
            historyVisible: false,
            catePlanObj: {},//引用传参
            appointReservaDialogVisible: false,
            latestAppointmentItem: {},
            analysisPicspIndex: ''
        };
    },

    created() {
        this.getAddressData();
        this.getPatientList();
        // if (this.currentTab == 'pictures') {
        //     this.getPhotoList();
        // }

    },
    computed: {
        ...mapGetters(["nickName", "userId", "isUpdate", "dept", "hospital", "device"]),
        isAdmin() {
            return this.$store.state.user.name === 'admin' ? true : false
        }
    },
    mounted() {
        console.log(this.device + '333')
        const el = this.$refs.myPhotoDiv
        if (el) {
            el.addEventListener('contextmenu', this.handleRightClick)
        }

        // console.log(this.$route)
        this.getCountAngle()
    },
    methods: {
        photocompare(){
           this.photoCompareMathDialogVisible=true
        },
        getlatestAppointment() {
            console.log(' this.basicInfo.patientId', this.basicInfo.patientId)
            latestAppointment({
                patientId: this.basicInfo.patientId,
            }).then(response => {
                if (response.code == 200) {
                    this.latestAppointmentItem = response.data
                }
            })
        },
        addNext() {
            if (!this.diagnosisQueryParams.visitNum) {
                this.$modal.msgWarning('请选择一条就诊记录!');
                return
            }
            this.appointReservaDialogVisible = true
        },
        closeAppointReserva() {//关闭弹窗
            this.appointReservaDialogVisible = false
            this.getlatestAppointment()
        },
        closeQuestion() {
            if (this.prediagnosisQuestionnaireDataList.length > 0) {
                this.formBaseStatus = true
                this.openQuestionnaire(this.prediagnosisQuestionnaireDataList[this.isActive], this.isActive)
            }
        },
        handleRightClick(event) {
            event.preventDefault()
        },
        downLoadphoto(url, item, name) {
            const imgUrl = url;// 图片链接
            // const a = document.createElement('a');
            // 这里是将url转成blob地址，
            let that = this
            fetch(imgUrl)  // 跨域时会报错
                .then(res => res.blob())
                .then(blob => { // 将链接地址字符内容转变成blob地址
                    that.convertToJPG(URL.createObjectURL(blob), 1, function (dataURL) {
                        // 这里的dataURL就是转换后的JPG图像的DataURL
                        // 如果需要将此图像下载为文件，可以使用以下代码
                        var link = document.createElement('a');
                        link.href = dataURL;
                        link.download = name + ' ' + item.visitNum + '(采集时间：' + item.createTime + ')';  //imgUrl.replace(/(.*\/)*([^.]+.*)/ig,"$2").split("?")[0] 下载文件的名字
                        document.body.appendChild(link);
                        link.click();
                        window.URL.revokeObjectURL(link.href);
                        document.body.removeChild(link);
                    });
                })
        },
        convertToJPG(sourceImage, quality, callback) {
            var image = new Image();
            image.src = sourceImage;
            image.onload = function () {
                var canvas = document.createElement('canvas');
                console.log(canvas)
                canvas.width = image.width;
                canvas.height = image.height;
                var ctx = canvas.getContext('2d');
                ctx.drawImage(image, 0, 0);
                var dataURL = canvas.toDataURL('image/jpeg', quality);
                callback(dataURL);
            };
        },
        getTreatmentReactionText(value) {
            let text = ''
            if (value.includes(',')) {
                let data = value.split(',')
                data.forEach((item, index) => {
                    this.dict.type.sys_treatment_reaction.forEach((row) => {
                        if (item === row.value) {
                            if (index + 1 < data.length) {
                                text = `${text + row.label},`
                            } else {
                                text += row.label
                            }
                        }
                    })
                })
            } else {
                this.dict.type.sys_treatment_reaction.forEach((row) => {
                    if (value === row.value) {
                        text = row.label
                    }
                })
            }
            return text
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map((item) => item.id);

            this.single = selection.length != 1;

        },
        delPics(pIndex) {
            const that = this
            that.$prompt('请输入删除照片原因', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
            }).then(({ value }) => {
                delPhotoByGroup(pIndex).then((res) => {
                    that.refreshList(2)
                    that.$modal.msgSuccess("删除成功");

                })
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '取消输入'
                });
            });
        },
        getSummaries(param) {
            const { columns, data } = param;
            const sums = [];
            console.log('getSummaries---', param)
            columns.forEach((column, index) => {
                if (index === 0) {
                    sums[index] = '合计';
                    return;
                }
                const values = data.map(item => Number(item[column.property]));
                if (column.label == '治疗价格') {
                    sums[index] = values.reduce((prev, curr) => {
                        const value = Number(curr);
                        if (!isNaN(value)) {
                            return prev + curr;
                        } else {
                            return prev;
                        }
                    }, 0);
                    sums[index] += ' 元';
                } else {
                    sums[index] = '';
                }
            });

            return sums;
        },
        gethospital(str) {
            if (str) {
                return str
            } else {
                return ''
            }
        },
        //专病问卷
        getClassifyList() {
            listClassify({ pageNum: 1, pageSize: 9999 }).then((response) => {
                this.classifyList = response.rows;
            });
        },
        addQuestionnaire2() {//新增专病问卷
            if (!this.questionForm.visitNum) {
                this.$modal.msgWarning('请选择一条就诊记录!');
                return
            }
            this.formBaseStatus = false
            this.selectData.diseaseId = null
            this.selectData.formId = null;
            this.formpreviewContList2 = null;
            this.questionnaireDialog2 = true;
            this.dialogNewAddBtnStatus2 = true;
            this.questionnaireTitle2 = "新增顾客专病诊前问卷";
        },
        async addQuestionForm2() {
            this.selectData.diseaseId = null
            this.selectData.formId = null;
            this.formpreviewContList2 = null;
            this.dialogNewAddBtnStatus2 = true;
            this.formList = []
            this.questionnaireTitle2 = "新增顾客专病问卷";
        },
        changeQuestionFormAdd() {
            let that = this
            that.getClassifyList()
            that.baseInfoData.forEach(function (ele) {
                if (ele.visitNum == that.questionForm.visitNum) {
                    console.log("___专病————")
                    console.log(ele)
                    that.formInfo2 = ele

                }
            })

        },
        //提交答案
        submitAnswer2() {
            const that = this
            that.$nextTick(() => {
                that.$refs.formPreview.$refs.listForm.validate((valid, object) => {
                    //console.log(that.$refs.formPreview.$refs.listForm);
                    if (valid) {
                        let answerArr = [];
                        const Vmodel = that.$refs.formPreview.$refs.listForm.model;
                        Object.keys(Vmodel).forEach((item) => {
                            answerArr.push({ answer: Vmodel[item], questionId: null });
                        });
                        that.formpreviewContList2.forEach((item, index) => {
                            that.$set(answerArr[index], "questionId", item.questionId);
                        });
                        let answerStr = JSON.stringify(answerArr);
                        let mData = {
                            visitId: that.formInfo2.visitId,
                            patientId: that.formInfo2.patientId,
                            formId: that.formInfo2.formId,
                            answer: answerStr,
                            formType: '1', //专病表单
                        };
                        addFormAnswer(1, mData).then((response) => {
                            that.$message.success('提交成功')
                            that.questionnaireDialog2 = false
                            this.refreshList(1)
                        });
                    } else {
                        this.$message({
                            message: '请完善问卷之后再提交~',
                            type: 'warning'
                        });
                    }
                });
            });
        },
        // 通过formid获取form内容
        getFormContByFormId(current) {
            if (current == "") {
                return;
            }
            listFormCont({
                formId: current,
            }).then((response) => {
                this.questionFormInfo2.name = response.name;
                this.questionFormInfo2.remark = response.remark;
                this.formpreviewContList2 = response.rows;
                let mAnswer = null;
                if (this.dialogNewAddBtnStatus2 === false) {
                    this.myAnswer2.forEach((it) => {
                        if (it.formId === current) {
                            mAnswer = JSON.parse(it.answer);
                            this.formInfo2.visitLogId = it.visitLogId;
                        }
                    });
                }
                this.formpreviewContList2.forEach((item, index) => {
                    if (this.dialogNewAddBtnStatus2 === false) {
                        this.$set(item, "answer", mAnswer[index].answer);
                    } else {
                        if (item.questionType == "2") {
                            this.$set(item, "answer", []);
                        } else {
                            this.$set(item, "answer", null);
                        }
                    }
                });
            });
            this.formInfo2.formId = current;
            console.log(this.formList);
        },
        /** 修改顾客专病诊前问卷按钮操作 */
        updateQuestionnaire2(row) {
            this.formpreviewContList2 = null;
            this.formInfo = row;
            this.selectData.formId = null;
            this.questionnaireTitle2 = "修改顾客专病诊前问卷";
            this.questionnaireDialog2 = true;
            this.dialogNewAddBtnStatus2 = false;
            diseaseQuestionnaireList(this.formInfo.visitId).then((response) => {
                this.myAnswer2 = response.data;
                console.log("点击修改按钮获取的答案和表单列表", this.myAnswer2);
                this.formList = this.myAnswe2
                this.selectData.formId = response.data[0].formId
                this.getFormContByFormId(this.myAnswer[0].formId);
            });
        },
        /** 查询表单列表 */
        getFormList(diseaseId) {
            this.selectData.formId = null;
            // let hospitalId
            // if (this.hospital.ancestors == '0') {
            //     hospitalId = ''
            // } else {
            //     hospitalId = this.hospital.deptId
            // }
            listFormDept(
                this.addDateRange({
                    pageNum: 1,
                    formType: "1",
                    diseaseId: diseaseId,
                    pageSize: 9999,
                    deptId: this.basicInfo.deptId,
                    status: '0',
                })
            ).then((response) => {
                this.formList = response.rows;
                //（目前先所有专病问卷，稍后补充）通用和专病混在一起了  这里跟之前单独的逻辑不一样了  这里还要把通用的问卷过滤除去 再把已填写的专病过滤出
                // let newArr = [];
                // console.log(this.myAnswer2)
                // //新增时过滤已经新增的  修改时只有已修改的
                // if (this.dialogNewAddBtnStatus2) {
                //     for (let i = 0; i < this.formList.length; i++) {
                //         if (!this.myAnswer2.find((item) => item.formId == this.formList[i].formId)) {
                //             newArr.push(this.formList[i]);
                //         }
                //     }
                // }
                // this.formList = newArr;
            });
        },
        //治疗方案
        newAddtreat() {
            this.recordbaseInfo.updateStatus = true
            this.submitStatus = true
            this.recordVisible = true
        },
        newUptreat() {
            const id = this.ids[0];
            this.recordbaseInfo.treatmentId = id
            this.recordbaseInfo.updateStatus = true
            this.submitStatus = false
            this.recordVisible = true
        },
        closerecordDialogVisible() {
            this.recordVisible = false
            this.refreshList(6)
        },
        //引用历史诊断方案
        catePlandiagnosis() {
            if (this.CountPatient.length > 1) {
                this.historyVisible = true
            }
        },
        //诊断方案
        addPlanCitate(data) {
            this.catePlanObj = data
            this.newAdddiagnosis(1)
            this.historyVisible = false

        },
        newAdddiagnosis(type) {//
            if (!this.diagnosisQueryParams.visitNum) {
                this.$modal.msgWarning('请选择一条就诊记录!');
                return
            }
            if (type != 1) {
                this.catePlanObj = undefined
            }
            this.baseInfo.updateStatus = false
            this.baseInfo.isDetail = 1
            this.baseInfo.referenceStatus = false
            this.diagnosisTitle = '新增方案'
            this.diagnosisDialogVisible = true
            this.$refs.Screenfull.open()
        },
        updatePlandiagnosis() {
            if (!this.diagnosisQueryParams.visitNum) {
                this.$modal.msgWarning('请选择一条就诊记录!');
                return
            }
            this.catePlanObj = undefined
            this.baseInfo.updateStatus = true
            this.baseInfo.referenceStatus = false
            this.diagnosisTitle = '修改方案'
            this.diagnosisDialogVisible = true
            this.$refs.Screenfull.open()
        },
        changeIsdiagnosisAdd() {
            let that = this
            console.log("刷新按钮了")
            that.baseInfoData.forEach(function (ele) {
                if (ele.visitNum == that.diagnosisQueryParams.visitNum) {
                    that.baseInfo = ele
                    console.log(Number(ele.status))
                    if (Number(ele.status) < 3) {
                        that.isdiagnosisAdd = 1
                        // && arr[0].doctor == that.nickName
                    } else if (Number(ele.status) == 3) {
                        that.isdiagnosisAdd = 2
                    } else {
                        that.isdiagnosisAdd = 3
                    }
                }
            })

        },
        changeIstreatAdd() {
            let that = this
            console.log("刷新按钮了")
            that.baseInfoData.forEach(function (ele) {
                if (ele.visitNum == that.treatmentRecordQueryParams.visitNum) {
                    console.log(Number(ele.status))
                    that.recordbaseInfo = ele
                    if (Number(ele.status) < 3) {
                        that.istreatAdd = 0
                    } else if (Number(ele.status) == 3) {
                        that.istreatAdd = 1
                    } else if (Number(ele.status) > 3) {
                        that.istreatAdd = 2
                        console.log("今日  222")

                    } else {
                        that.istreatAdd = 0
                    }
                }
            })
        },
        closefullScreen() {
            this.$refs.Screenfull.closed()
        },
        closediagnosisDialogVisible() {
            this.diagnosisDialogVisible = false
            this.refreshList(5)
            this.getPatientList()
        },
        // 录入指标 saveDetection
        handleAdd() { //新增检测指标
            if (!this.detectionIndexForm.visitNum) {
                this.$modal.msgWarning('请选择一条就诊记录!');
                return
            }
            this.baseAdd = {};
            this.baseAdd.isDetail = true;
            this.baseAdd.isShow = 1
            this.baseAdd.visitNum = this.detectionIndexForm.visitNum
            this.baseAdd.patientName = this.detectionIndexForm.patientName
            this.baseAdd.patientId = this.detectionIndexForm.patientId
            console.log(this.baseAdd)
            this.planTitle = "检测指标";
            this.centerDialogVisible = true;
        },
        closeCenterDialogVisible() {
            this.centerDialogVisible = false
            this.refreshList(8)
        },
        //调取摄像头拍摄
        openShooting(type) {
            this.cameraShootingVisible = true
            this.cameraShootingType = type

        },
        //关闭摄像头拍摄
        closeShooting(imgSrc, imgFile) {
            this.cameraShootingVisible = false
            this.blobs = []
            this.imageInfo = []
            this.blobs.push(imgFile)
            this.imageInfo.push({ url: imgSrc })
        },
        //获取已上传的缴费凭证或知情同意书
        getConsentList1(visitNum, type) {
            consentList(visitNum, type).then(
                (response) => {
                    if (response.code == 200) {

                        this.imageInfo = response.data
                        this.imageInfo.forEach((item) => {
                            item.url = this.baseUrl + item.url
                        })
                        this.loading = false
                    } else {
                        this.$modal.msgError(response.msg);
                        this.loading = false

                    }
                }
            )
        },
        //删除图片
        removeImg(img, idx) {
            this.$confirm('此操作将删除该照片, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(() => {
                    this.imageInfo = this.imageInfo.filter(item => {
                        return item.url != img.url
                    })
                    this.blobs.splice(idx, 1)

                })
                .then(() => {
                    this.$modal.msgSuccess("删除成功");
                })
                .catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    })
                })

        },
        //获取图片
        async uploadImage() {
            const blobs = await fileOpen({
                mimeTypes: ['image/*'],
                multiple: true,
            });

            this.blobs.push(...blobs)
            // console.log('uploadImage-blobs-',this.blobs )
            this.imageInfo = []
            this.blobs.forEach((item, index) => {
                const reader = new FileReader();
                reader.readAsDataURL(item)
                reader.onload = () => {
                    this.imageInfo.push({ url: reader.result })
                };
            })
            console.log('imageInfo--', this.imageInfo)
        },
        //关闭知情同意书
        closeConfirmKnow() {
            this.confirmKnowVisible = false
            this.uploadPhotosVisible = false
            this.blobs = []//获取的知情同意书照片信息
            this.imageInfo = []//上传的本地知情同意书照片信息
        },
        //打开知情同意书
        confirmKnow(type) {
            if (!this.consentForm.visitNum) {
                this.$modal.msgWarning('请选择一条就诊记录!');
                return
            }
            if (type == '1') {
                this.confirmKnowVisible = true
            } else if (type == '3') {
                this.uploadPhotosVisible = true
            }

            this.getConsentList1(this.consentForm.visitNum, type)
        },
        //确认已签署
        handleCloseConfirmKnow(type) {
            if (this.blobs.length == 0) {
                this.$modal.msgWarning("请上传图片");
                return
            }
            this.loading = true

            // 创建FormData对象，通过该对象实现批量文件上传
            let fd = new FormData()
            // 因为要上传多个文件，所以需要遍历一下才行,不要直接使用我们的文件数组进行上传，你会发现传给后台的是两个Object
            this.blobs.forEach(function (file) {
                // 遍历files数组，将file添加到FormData对象中
                fd.append("files", file, file.name)
                // console.log('fd.append',file,fd.getAll('files'))
            })
            let Mdata = {
                type: type,
                visitNum: this.consentForm.visitNum,
                data: fd,
            }
            consentUploads(Mdata).then(
                (response) => {
                    if (response.code == 200) {
                        this.loading = false
                        this.$modal.msgSuccess(response.msg);
                        this.closeConfirmKnow()

                        if (type == '1') {
                            this.refreshList(3)
                        } else if (type == '3') {
                            this.refreshList(9)
                        }



                    } else {
                        this.loading = false
                        this.$modal.msgError(response.msg);
                    }
                }
            )
        },
        getCountAngle() {
            const patientId = this.basicInfo.patientId
            getAngleCount(patientId).then((res) => {
                this.countAngle = res.data
            })
        },
        // 真实序号计算（计算分页影响）
        getIndex(index) {
            return (
                (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1
            );
        },
        getTreatmentRecordIndex(index) {
            return (
                (this.treatmentRecordQueryParams.pageNum - 1) * this.treatmentRecordQueryParams.pageSize + index + 1
            );
        },
        getDetectionIndexFormIndex(index) {
            return (
                (this.detectionIndexForm.pageNum - 1) * this.detectionIndexForm.pageSize + index + 1
            );
        },
        //获取诊断状态字典值对应的label
        getDiagnosisStatusLabel(status) {
            let label = ''
            this.dict.type.sys_diagnosis_status.forEach((item) => {
                if (item.value == status) {
                    label = item.label
                }
            })
            return label

        },
        //获取顾客历史诊断记录
        getCountPatient() {
            const patientId = this.basicInfo.patientId
            const queryParams = { pageNum: 1, pageSize: 9999, patientId: patientId }
            getList(queryParams).then((response) => {
                let data = response.rows
                this.CountPatient = data
            })
        },
        // 获取顾客登记列表
        getPatientList(type) {
            const patientId = this.basicInfo.patientId
            const queryParams = { pageNum: 1, pageSize: 9999, patientId: patientId }
            this.getCountPatient()
            getVisit(queryParams).then(
                (response) => {
                    this.baseInfoData = response.rows
                    this.baseInfoData.forEach(item => {
                        item.doctorDiagnosis = item.doctorDiagnosis.replace(/ *\([^)]*\) */g, "")
                    })
                    if (type == 5) {
                        this.changeIsdiagnosisAdd()
                        this.getlatestAppointment()

                    } else if (type == 6) {
                        this.changeIstreatAdd()
                    }
                    // this.baseInfoData.forEach(item => {
                    //     item.area = [
                    //         Number(item.provinceId),
                    //         Number(item.cityId),
                    //         Number(item.countyId),
                    //     ];
                    // })
                }
            )

        },
        getPicPreviewList(row) {
            this.srcList = []
            this.fileSizeListData = []
            row.sysPatientPhotos.forEach((it) => {
                this.srcList.push(it.photoAddress)
                this.fileSizeListData.push(`<div>姓名:${it.patientName}</div><div>年龄:${it.age}</div><div >医生诊断:${it.doctorDiagnosis}</div><div>采集状态:${this.matchDict('sys_diagnosis_status', it.status)}</div><div>采集设备:${this.matchDict('photo_upload_type', it.type)}</div><div>采集日期:${it.createTime}</div><div>采集人:${it.nickName}</div><div >${it.scoreAi ? 'Ai mMASI评分:' + it.scoreAi + '分' : ''} </div ><div style='margin-top:20px'>光照类型:${this.matchDict('photo_lighting_type', it.faceLight)}</div><div>部位:${this.matchDict('sys_face_part', it.facePart)}</div><div>文件大小:${(it.fileSize / 1024 / 1024).toFixed(2)}M</div><div>压缩比:${it.compressionRatio}</div>`)
            })
        },
        /** id转化成对应的文字 */
        matchDict: function (key, id) {
            let _this = this;
            const result = _this.dict.type[key];
            let textValue = "";
            result.forEach((item) => {
                if (item.raw.dictValue == id) {
                    textValue = item.raw.dictLabel;
                }
            });
            return textValue;
        },
        // 真实序号计算（计算分页影响）
        getWarmReminderRecordIndex(index) {
            return (this.warmReminderRecordParams.pageNum - 1) * this.warmReminderRecordParams.pageSize + index + 1;
        },
        //温馨提示记录
        getWarmReminderRecord() {
            getTipsList(this.warmReminderRecordParams).then(response => {
                if (response.code == 200) {
                    this.warmReminderRecordData = response.rows
                    listText({
                        pageNum: 1,
                        pageSize: 9999,
                        diseaseId: ''
                    }).then((res) => {
                        this.warmReminderClassifyList = res.rows;
                    });
                } else {
                }
            })
        },
        lookRecordItem(row) {
            this.warmReminderDialogVisible = true
            this.warmReminderForm = row
            this.warmReminderContent = this.warmReminderClassifyList.find(item => {
                return item.textId == this.warmReminderForm.textId
            })

        },
        handleconsentDialog(row) { this.consentDialog = true },
        /** 知情同意书 */
        getConsentList(type) {
            this.consentForm.type = type
            consentListAll(this.consentForm).then(
                (response) => {
                    if (response.code == 200) {
                        this.consentDataList = response.data
                        // console.log('getConsentList---', response)
                    } else {
                        this.$modal.msgError(response.msg);

                    }
                }
            )
        },
        getConsentPreviewList(row) {
            this.consentSrcList = []
            row.sysNformedConsents.forEach((it) => {
                this.consentSrcList.push(this.baseUrl + it.url)
            })
        },
        //添加照片
        addphoto() {
            if (!this.pictureForm.visitNum) {
                this.$modal.msgWarning('请选择一条就诊记录!');
                return
            }
            let that = this
            console.log(that.baseInfoData)
            that.baseInfoData.forEach(function (ele) {
                if (ele.visitNum == that.pictureForm.visitNum) {
                    console.log(ele)
                    that.patientItem = ele
                    that.pictureDatileopen = true
                }
            })
        },
        addQuestionnaire() {//新增诊前问卷
            console.log('addQuestionnaire--', this.basicInfo)
            if (!this.questionForm.visitNum) {
                this.$modal.msgWarning('请选择一条就诊记录!');
                return
            }
            this.formBaseStatus = false
            this.formInfo.patientId = this.basicInfo.patientId
            let hospitalId
            // if (this.hospital.ancestors == '0') {
            //     hospitalId = ''
            // } else {
            //     hospitalId = this.hospital.deptId
            // }
            currencyFormId({ deptId: this.basicInfo.deptId }).then((res) => {
                if (res.code == 200) {
                    let that = this
                    that.formInfo.formId = res.data;
                    console.log(that.prediagnosisQuestionnaireDataList)
                    if (res.data) {
                        that.baseInfoData.forEach(function (ele) {
                            if (ele.visitNum == that.questionForm.visitNum) {
                                that.formInfo.visitId = ele.visitId
                                that.getFormContList1();
                            }
                        })
                        that.dialogNewAddBtnStatus = true;
                        that.questionnaireTitle = "新增顾客通用诊前问卷";
                    }

                }

            });
        },
        /** 弹窗查询表单内容控件列表 */
        getFormContList1() {
            listFormCont({
                formId: this.formInfo.formId,
            }).then((response) => {
                this.questionFormInfo1.name = response.name;
                this.questionFormInfo1.remark = response.remark;
                this.formpreviewContList1 = response.rows;
                this.formpreviewContList1.forEach((item, index) => {
                    if (this.dialogNewAddBtnStatus === false) {
                        this.$set(item, "answer", this.myAnswer1[index].answer);
                    } else {
                        if (item.questionType === "2") {
                            this.$set(item, "answer", []);
                        } else {
                            this.$set(item, "answer", null);
                        }
                    }
                });
            });
            this.questionnaireDialog = true;
        },
        /** 修改诊前问卷按钮操作 */
        updateQuestionnaire() {
            this.dialogNewAddBtnStatus = false;
            this.formInfo.patientId = this.basicInfo.patientId
            let that = this
            this.baseInfoData.forEach(function (ele) {
                if (ele.visitNum == that.questionForm.visitNum) {
                    that.formInfo.visitId = ele.visitId
                    getQuestionnaireCommon(ele.visitId).then((response) => {
                        const visitLogId = response.data[0].visitLogId;
                        console.log("点击修改按钮获取的答案和表单列表", that.myAnswer1);
                        detailFormAndAnswer(visitLogId).then((response) => {
                            that.formInfo = response.data;
                            that.myAnswer1 = JSON.parse(response.data.answer);
                            that.getFormContList1();
                        });
                    });
                    that.questionnaireTitle = "修改顾客通用诊前问卷";
                }
            })
        },
        //新增诊前问卷
        submitAnswer() {
            this.$nextTick(() => {
                this.$refs.formPreview.$refs.listForm.validate((valid, object) => {
                    console.log(valid);
                    if (valid) {
                        let answerArr = [];
                        const Vmodel = this.$refs.formPreview.$refs.listForm.model;
                        Object.keys(Vmodel).forEach((item) => {
                            answerArr.push({ answer: Vmodel[item], questionId: null });
                        });
                        this.formpreviewContList1.forEach((item, index) => {
                            this.$set(answerArr[index], "questionId", item.questionId);
                        });
                        let answerStr = JSON.stringify(answerArr);
                        let mData = {
                            visitId: this.formInfo.visitId,
                            patientId: this.formInfo.patientId,
                            formId: this.formInfo.formId,
                            answer: answerStr,
                            formType: 0, //通用表单
                        };
                        addFormAnswer(1, mData).then((response) => {
                            if (response.code == 200) {
                                this.$message.success("提交成功");
                                this.questionnaireDialog = false;
                                this.refreshList(1)
                            }

                            // this.getFormContList()
                        });
                    } else {
                        this.$message({
                            message: '请完善问卷之后再提交~',
                            type: 'warning'
                        });
                    }
                });
            });
        },
        /** 修改诊前问卷按钮操作 */
        async updateFormAnswer() {
            this.$nextTick(() => {
                this.$refs.formPreview.$refs.listForm.validate((valid) => {
                    if (valid) {
                        let answerArr = [];
                        const Vmodel = this.$refs.formPreview.$refs.listForm.model;
                        Object.keys(Vmodel).forEach((item) => {
                            answerArr.push({ answer: Vmodel[item], questionId: null });
                        });
                        this.formpreviewContList.forEach((item, index) => {
                            this.$set(answerArr[index], "questionId", item.questionId);
                        });
                        let answerStr = JSON.stringify(answerArr);
                        let mData = {
                            visitLogId: this.formInfo.visitLogId,
                            answer: answerStr,
                        };
                        console.log(this.formInfo.visitLogId)
                        updateAnswer(1, mData).then((response) => {
                            if (response.code == 200) {
                                this.$message.success("修改成功");
                                this.questionnaireDialog = false;
                                this.refreshList(1)
                            }

                        });
                    }
                });
            });
        },
        refreshList(type) {
            if (type == 1) { //诊前问卷
                this.formBaseStatus = true
                this.formInfo.patientId = this.basicInfo.patientId
                let that = this
                that.getListCustomerForm()
                // this.baseInfoData.forEach(function (ele) {
                //     if (ele.visitNum == that.questionForm.visitNum) {
                //         that.formInfo.visitId = ele.visitId
                //         getQuestionnaireCommon(ele.visitId).then((response) => {
                //           console.log('getQuestionnaireCommon----',response)
                //             const visitLogId = response.data[that.isActive].visitLogId;
                //             detailFormAndAnswer(visitLogId).then((response) => {
                //                 that.formInfo = response.data;
                //                 that.myAnswer = JSON.parse(response.data.answer);
                //                 that.getFormContList();
                //             });
                //         });
                //         that.getListCustomerForm()
                //     }
                // })
            } else if (type == 2) { //照片
                this.getPhotoList()
                this.pictureDatileopen = false
            } else if (type == 3) { //知情同意书
                this.getConsentList('1')
            } else if (type == 4) { //温馨提示

            } else if (type == 5) {//诊断方案
                this.getDiagnosisAndProject()

            } else if (type == 6) {//治疗
                this.getTreatmentList()

            } else if (type == 8) {//检测指标
                this.getlistDetectionVisit()
            } else if (type == 9) {//治疗照片
                this.getConsentList('3')
            }
            this.getCountAngle()
        },
        /** 诊前问卷按钮操作 */
        async openQuestionnaire(row, index) {
            this.isActive = index
            this.formInfo = row;
            if (row) {
                console.log('openQuestionnaire', row)
                this.myAnswer = JSON.parse(row.answer)
                await this.getFormContList()
                this.questionnaireTitle = row.name
            }


        },
        // 获取地区
        getAddressData() {
            addressJson().then((res) => {
                this.areaList = res.data;
            });
        },

        //根据病人id获取图片列表
        getPhotoList(index) {
            this.picDataStatus = false
            listPhoto(this.addDateRange(this.pictureForm, this.dateRange)).then((res) => {
                let that = this
                if (res.data.length > 0) {
                    this.picData = res.data;
                    this.picData.forEach((item, indexs) => {
                        item.scoreAiAll = 0
                        item.sysPatientPhotos.forEach(it => {
                            if (it.score && JSON.parse(it.score).left) {
                                it.scoreAi = 0.3 * JSON.parse(it.score).left.area * JSON.parse(it.score).left.color
                                if (indexs === index) {
                                    this.loadingIndex = ''
                                    this.$message.success("Ai分析成功");
                                    clearInterval(that.cycleTimer);
                                }
                            }
                            if (it.score && JSON.parse(it.score).brow) {
                                it.scoreAi = 0.3 * JSON.parse(it.score).brow.area * JSON.parse(it.score).brow.color + 0.1 * JSON.parse(it.score).chin.area * JSON.parse(it.score).chin.color
                                if (indexs === index) {
                                    this.loadingIndex = ''
                                    // this.$message.success("Ai分析成功");
                                    clearInterval(that.cycleTimer);
                                }
                            }
                            if (it.score && JSON.parse(it.score).right) {
                                it.scoreAi = 0.3 * JSON.parse(it.score).right.area * JSON.parse(it.score).right.color
                                if (indexs === index) {
                                    this.loadingIndex = ''
                                    // this.$message.success("Ai分析成功");
                                    clearInterval(that.cycleTimer);
                                }
                            }
                            if (it.scoreAi != null) {
                                item.scoreAiAll += it.scoreAi
                            }
                            it.patientName = item.patientName
                            it.age = item.age
                            it.doctorDiagnosis = item.doctorDiagnosis.replace(/ *\([^)]*\) */g, "")
                            it.points = this.formatPoints(it.points)
                        })
                    })
                    console.log('this.picData---', this.picData)
                    this.picDataStatus = true
                } else {
                    this.picData = [];
                    this.picDataStatus = true
                }
            });
        },
        //格式化画图组件点位格式数据
        formatPoints(data) {
            if (data != null) {
                let mData = []
                console.log(JSON.parse(data))
                JSON.parse(data).forEach((item, index) => {
                    let itPoint = []
                    item.forEach((it, mindex) => {
                        itPoint.push({ x: it[0], y: it[1] })
                        if (item.length - 1 === mindex) {
                            //最后一个点连接到第一个点形成闭合
                            itPoint.push({ x: item[0][0], y: item[0][1] })
                        }
                    })
                    mData.push({ points: itPoint, type: 'route' })
                })
                console.log(mData)
                return mData
            } else {
                return null
            }
        },
        watchBigPic(row, Mindex) {
            console.log(row)
            this.myImgIndex = Mindex
            this.currentUrl = row.sysPatientPhotos[Mindex].photoAddress
            row.sysPatientPhotos.forEach(item => {
                item.patientName = row.patientName
                item.age = row.age
                item.photoType = row.photoType;
                item.photoIndex = row.p_index;
                item.doctorDiagnosis = row.doctorDiagnosis.replace(/ *\([^)]*\) */g, "")
            })
            this.imgList = row.sysPatientPhotos
            this.$refs.Screenfull.open()
            this.picMarkDialogVisible = true
        },
        openPics(row, Mindex) {
            this.myImgIndex = Mindex
            this.currentUrl = row.sysPatientPhotos[Mindex].photoAddress
            row.sysPatientPhotos.forEach(item => {
                item.patientName = row.patientName
                item.age = row.age
                item.doctorDiagnosis = row.doctorDiagnosis.replace(/ *\([^)]*\) */g, "")
            })
            this.$refs.Screenfull.open()
            this.analysisPicspIndex = row.p_index
            this.imgList = row.sysPatientPhotos
            this.analysisPicsVisiable = true
        },
        openAIReport(row) {
            const { href } = this.$router.resolve({
                name: 'aiAnalysisReport',
                path: '/aiAnalysisReport',
                query: {
                    id: row.p_index,
                    checkinCode: row.checkinCode
                }
            })
            console.log(href)
            this.reportURL = href
            this.reportVisiable = true

        },
        copyAIReport(row) { // copy复制链接
            this.copyValue = location.origin + '/aiAnalysisReport?id=' + row.p_index
            this.$refs.copyInput.value = this.copyValue;
            this.$refs.copyInput.select();
            document.execCommand('copy');
            this.$modal.msgSuccess("复制成功~");
        },
        //启动黄褐斑AI
        startHhbAi(item, index) {
            let that = this
            if (this.loadingIndex) {
                this.$confirm('已有照片正在评分,请稍后再试!', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                }).then(() => {

                }).catch(() => {

                });
                return
            }
            if (item.scoreAiAll) {
                this.$confirm('已有Ai mMASI评分,请确定是否进行重新评分?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                }).then(() => {
                    if (that.cycleTimer) {
                        clearInterval(that.cycleTimer);
                    }
                    this.startHhbAiAgain(item, index)
                }).catch(() => {
                    return
                });
            } else {
                this.startHhbAiAgain(item, index)
            }
        },
        startHhbAiAgain(item, index) {
            let photoIds = []
            let comparePhotoIds = []
            let photoItem1 = item.sysPatientPhotos.find(it => {
                return it.faceLight == '1' && it.facePart == '0'
            })
            let photoItem2 = item.sysPatientPhotos.find(it => {
                return it.faceLight == '1' && it.facePart == '1'
            })
            let photoItem3 = item.sysPatientPhotos.find(it => {
                return it.faceLight == '1' && it.facePart == '2'
            })
            item.sysPatientPhotos.forEach(it => {
                if (it.faceLight == '1' && it.facePart == '0') {
                    comparePhotoIds.push(it.photoId)
                }
                if (it.faceLight == '1' && it.facePart == '1') {
                    comparePhotoIds.push(it.photoId)
                }
                if (it.faceLight == '1' && it.facePart == '2') {
                    comparePhotoIds.push(it.photoId)
                }
            })
            if (photoItem1 && photoItem2 && photoItem3 && comparePhotoIds.length == 3) {
                photoIds.push(photoItem1.photoId)
                photoIds.push(photoItem2.photoId)
                photoIds.push(photoItem3.photoId)
                photoIds = photoIds.join(',')
                console.log('photoIds---', photoIds)
                startAi({ photoIds: photoIds, type: '0' }).then(response => {
                    if (response.code == 200) {
                        let that = this
                        that.loadingIndex = item.p_index
                        if (item.scoreAiAll) {
                            setTimeout(function () {
                                that.getPhotoList(index)
                            }, 9000)
                        } else {
                            that.cycleTimer = setInterval(function () {
                                console.log("每隔3s执行一次");
                                that.getPhotoList(index)
                            }, 3000);
                        }

                    }
                })
            } else {
                this.$confirm(`无法进行Ai分析,Ai分析需光照类型为<strong>Standard</strong>,且脸部部位为<strong>左面部, 正面部, 右面部</strong>有且有三张!`, '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    dangerouslyUseHTMLString: true,
                }).then(() => {
                    return
                }).catch(() => {
                    return
                });
            }

        },
        //筛选值

        //tab点击切换
        tabHandleClick(tab, event) {
            if (tab.name === "PrediagnosisQuestionnaire") {
                this.isActive = 0
                this.questionForm.visitNum = this.basicInfo.visitNum
                this.questionForm.visitId = this.basicInfo.visitId
                this.getListCustomerForm()
            }
            if (tab.name === "pictures") {
                this.pictureForm.visitNum = this.basicInfo.visitNum
                this.pictureForm.patientId = this.basicInfo.patientId
                this.getPhotoList()
            }
            if (tab.name === "consent") {
                this.consentForm.visitNum = this.basicInfo.visitNum
                this.consentForm.patientId = this.basicInfo.patientId
                this.getConsentList('1')
            }
            if (tab.name === "treatmentPhoto") {
                this.consentForm.visitNum = this.basicInfo.visitNum
                this.consentForm.patientId = this.basicInfo.patientId
                this.getConsentList('3')
            }
            if (tab.name === "warmReminder") {
                this.warmReminderRecordParams.visitNum = this.basicInfo.visitNum
                this.warmReminderRecordParams.patientId = this.basicInfo.patientId
                this.getWarmReminderRecord()
            }
            if (tab.name === "followupVisitDataList") {
                this.getListCustomerForm()
            }
            if (tab.name === "diagnosisAndProject") {
                this.diagnosisQueryParams.visitNum = this.basicInfo.visitNum
                this.diagnosisQueryParams.patientId = this.basicInfo.patientId
                // this.getDiagnosisAndProject()
                this.refreshList(5)

            }
            if (tab.name === "treatmentRecord") {
                this.treatmentRecordQueryParams.visitNum = this.basicInfo.visitNum
                this.treatmentRecordQueryParams.patientId = this.basicInfo.patientId
                // this.getTreatmentList()
                this.refreshList(6)
            }
            if (tab.name === "detectionIndex") {
                this.detectionIndexForm.visitNum = this.basicInfo.visitNum
                this.detectionIndexForm.patientId = this.basicInfo.patientId
                this.detectionIndexForm.patientName = this.basicInfo.patientName
                this.getlistDetectionVisit()
            }
        },
        //获取指标录入列表
        getlistDetectionVisit() {
            listDetectionVisit(this.detectionIndexForm).then(
                (response) => {
                    if (response.rows.length > 0) {
                        this.listDetectionVisit = response.rows
                        this.Listtotal = response.total;
                        console.log(this.Listtotal)
                        this.loading = false;
                    } else {
                        this.listDetectionVisit = []
                        this.Listtotal = 0;
                        this.loading = false;
                    }
                }
            )
        },
        getLabel(row) {
            let labeltext = ''
            if (row.hightValue != '' && row.hightValue != null && row.limitValue != '' && row.limitValue != null) {//文本值
                if ((Number(row.hightValue) >= Number(row.detectionValue)) && (Number(row.detectionValue) >= Number(row.limitValue))) {
                    labeltext = '正常'
                } else {
                    labeltext = '异常'
                }
            } else if ((row.hightValue == '' || row.hightValue == null) && row.defaultValue != '' && row.defaultValue != null) {
                if (row.detectionValue == row.defaultValue) {
                    labeltext = '正常'
                } else {
                    labeltext = '异常'
                }
            }
            return labeltext
        },
        comparePics() { this.comparePicsDialogVisible = true },
        // 获取顾客诊断列表
        getDiagnosisAndProject() {
            // const patientId = this.basicInfo.patientId
            // const queryParams = { pageNum: 1, pageSize: 9999, patientId: patientId }
            // listVisitTip(queryParams).then((response) => {
            //     this.diagnosisAndProjectDataList = response.rows.filter((item) => Number(item.status) >= 3);
            // });

            listVisitTip(this.diagnosisQueryParams).then((response) => {
                this.diagnosisAndProjectDataList = response.rows.filter((item) => Number(item.status) >= 1);
                this.diagnosisAndProjectDataList.forEach(item => {
                    if (item.doctorDiagnosis.includes(';')) {
                        let MobjectDoctor = ''
                        item.doctorDiagnosis.split(';').forEach(it => {
                            MobjectDoctor += it + '<br>'
                        })
                        item.doctorDiagnosis = MobjectDoctor
                    }
                    if (item.consultationDiagnosis.includes(';')) {
                        let Mobject = ''
                        item.consultationDiagnosis.split(';').forEach(it => {
                            Mobject += it + '<br>'
                        })
                        item.consultationDiagnosis = Mobject
                    }
                })
                console.log("点击切换")
                this.getPatientList(5)
            });
        },
        //获取该就诊编号的医生诊断信息
        goHistoryDiagnosis(row) {
            this.historyDiagnosisDialogVisible = true
            this.historyDiagnosisSignalList = []

            myHistoryDiagnosis(row.visitNum).then(response => {
                // console.log('goMoreDiagnosis---',response)
                if (response.data.length > 0) {
                    this.historyDiagnosisList = response.data
                    response.data.forEach(item => {
                        item.sysVisitPlan.nick_name = item.nick_name
                        item.sysVisitPlan.patientName = row.patientName
                        if (item.sysVisitPlan.diagnosis.includes(';')) {
                            let MobjectDoctor = ''
                            item.sysVisitPlan.diagnosis.split(';').forEach(it => {
                                MobjectDoctor += it + '<br>'
                            })
                            item.sysVisitPlan.diagnosis = MobjectDoctor
                        }

                    })
                    this.historyDiagnosisSignalList = response.data.map(item => {
                        return item.sysVisitPlan
                    })

                    console.log('historyDiagnosisSignalList', this.historyDiagnosisSignalList)
                }

            })

        },
        // 获取顾客治疗列表
        getTreatmentList() {

            getTreatmentList(this.treatmentRecordQueryParams).then(
                (response) => {
                    if (response.code == 200) {
                        this.treatmentRecordDataList = response.rows;
                        this.treatmentRecordTotal = response.total
                    } else {
                        this.$modal.msgError(response.msg);
                    }
                    this.getPatientList(6)
                }
            )
        },
        /** 查询表单内容控件列表 */
        getFormContList() {
            listFormCont({
                formId: this.formInfo.formId
            }).then((response) => {
                this.questionFormInfo.name = response.name
                this.questionFormInfo.remark = response.remark
                this.formpreviewContList = response.rows;
                this.formpreviewContList.forEach((item, index) => {
                    this.$set(item, 'answer', this.myAnswer[index].answer)
                })
            });
        },

        /** 查询顾客表单列表 */
        getListCustomerForm() {
            let that = this
            let index = that.isActive
            that.changeQuestionFormAdd()
            if (this.baseInfoData.length > 0) {
                const patientId = this.basicInfo.patientId
                // this.questionForm.visitNum = this.baseInfoData[0].visitNum
                listCustomerForm({ patientId: patientId, visitNum: this.questionForm.visitNum }).then((response) => {
                    that.prediagnosisQuestionnaireDataList = response.rows
                    if (response.rows.length > 0) {
                        that.openQuestionnaire(response.rows[index])
                        that.isActive = index
                    } else {
                        that.formpreviewContList = null
                    }
                });
            }

        },



    },
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">

.date-header {
    line-height: 60px;
    color: red;
}

.treatment-tips {
    text-align: center;
    line-height: 60px;
}

.img-txt:hover {
    .downBtn {
        position: absolute;
        top: 10px;
        right: 0px;
        display: block;
    }
}

.img-txt {
    display: flex;
    flex-direction: column;
    text-align: center;
    margin: 14px;
    position: relative;

    .downBtn {
        position: absolute;
        top: 10px;
        right: 0px;
        display: none;
    }

    .user-info-head {
        width: 260px;
        height: 412px;

        //border: 1px solid #000;
        .img-style {
            width: 100%;
            height: 100%;

            ::v-deep .el-image__error {
                opacity: 0;
            }
        }
    }
}

.consentBox {
    display: flex;
    flex-wrap: wrap;

    .consentBoxImage {
        width: 260px;
        height: 370px;
        margin: 14px;
    }

    .consentBoxtext {
        text-align: center;
    }

}

.uploadImageBox {
    //width: 500px;
    min-height: 500px;
    border: 1px solid #f3a4a1;
    margin: 10px auto;

    .draggable-item {
        display: inline-block;
        margin: 0 8px 8px 0;
        font-size: 0;
        line-height: 0;
        vertical-align: middle;
        position: relative;
    }
}

.icon-close {
    position: absolute;
    right: 0;
    top: 0;
    font-size: 18px;
    color: #00be8b;
    z-index: 1;
}

::v-deep .el-collapse-item__header {
    font-size: 15px;
    color: #409EFF;
}

::v-deep .selectForm .el-form-item__content {
    width: calc(100% - 100px);
}

.base-info-box {
    margin: 20px 0;
    font-size: 15px;
}

.base-info-box span {
    margin-right: 15px;
}

.group-info {
    display: flex;
    margin-top: 5px;
}

.group-info span {
    margin-right: 15px;
}

.group-info .device div {
    display: inline-block;
    vertical-align: top;
}

.yesActive {
    background-color: #409EFF;
    color: #fff;
}

.center-tabs {
    min-height: 600px;
}

::v-deep .el-dialog {
    margin-top: 0 !important;
}

.min-height {
    min-height: 700px;
}

::v-deep .selectRed {
    .el-input__inner {
        border: 1px solid red;
    }
}

.bigFont {
    font-weight: bold;
    font-size: 15px;

    .normalFont {
        font-weight: normal;
    }
}
</style>
